<%@ page language="java"
         import="com.ruohi.manage.DBType,com.ruohi.manage.PoolManager,com.ruohi.util.common.*,com.ruohi.util.dbutil.DBHelper,java.sql.Connection"
         pageEncoding="UTF-8" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%
	Connection connection = null;
	String tablePrefix = Env.getInstance().getProperty("table_prefix");
	DBHelper dbHelper = DBHelper.getInstance();
	Map model = new HashMap();
	String tableName = " gift_product_repair ";
	try{
		connection = PoolManager.getConnection(DBType.getDBTypeByEnum("106013"));
		String id = CommonString.getFormatPara(request.getParameter("id"));
		String channelUUID = CommonString.getFormatPara(request.getParameter("channel_uuid"));
		if(null!=id&&!"".equals(id)){
			model = dbHelper.getMap(" select * from "+tableName+" where uuid = ? ",new Object [] {id} , connection);
		}
		if("".equals(channelUUID)&&null!=model){
			channelUUID = (String)model.get("channel_uuid");
		}
		Map enumMap117 = (Map)CommonApplication.getEnumChildren("117",application);
		Map enumMap118 = (Map)CommonApplication.getEnumChildren("118",application);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=Env.getInstance().getProperty("project_name") %></title>
<link href="/plugin/ui/ligerUI/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<link href="/backend/style/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/plugin/other/highslide/highslide.css" />
<script src="/plugin/jquery/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="/plugin/editor/ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="/plugin/editor/ueditor/editor_all_min.js"></script>
<link rel="stylesheet" type="text/css" href="/plugin/editor/ueditor/themes/default/ueditor.css"/>
</head>

<body style="margin: 0;padding: 0; overflow-x: hidden; ">
<form name="theform" id="theform" action="/backend/action/crud.jsp?enumNo=106013">
  <div class="formDiv">
    <div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">商品信息</span> </div>
    <div class="formLeft">涉及订单号</div>
    <div class="formRight" style="width:190px">
      <a href="javascript://void(0);" onclick="viewOrderDetail('<%=CommonString.getFormatPara(model.get("order_num")) %>');"><%=CommonString.getFormatPara(model.get("order_num")) %></a>
    </div>
    <div class="formLeft">商品名称</div>
    <div class="formRight" style="width:190px">
        <a target="_blank"
           href="http://www.52sdskj.com/goods/<%=CommonString.getFormatPara(model.get("product_no")) %>.htm"><%=CommonString.getFormatPara(model.get("product_name")) %>
        </a>
    </div>
    <div style="clear:left;"></div>
    <div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">申请信息</span> </div>
      <div class="formLeft">申请时间</div>
      <div class="formRight" style="width: 190px;">
          <label><%=CommonDate.getFormatDate("yyyy-MM-dd HH:mm:ss", model.get("add_date")) %>
          </label>
      </div>
    <div class="formLeft">期望处理类型</div>
    <div class="formRight" style="width:190px">
        <select name="zd_type" id="zd_type" class="jr_select" disabled="true">
            <option value="">-选择类型-</option>
            <%=CommonForm.createSelect(enumMap117,CommonString.getFormatPara(model.get("type"))) %>
        </select>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">问题描述</div>
    <div class="formRight" style="height: 55px; text-align: left;"> 
      <textarea class="jr_textarea" id="zd_describ" name="zd_describ" readonly="true" style="height:50px"><%=CommonString.getFormatPara(model.get("describ")) %></textarea>
    </div>
  </div>
   <div style="clear:left;"></div>
    <div class="formLeft">退换数量</div>
    <div class="formRight" style="width: 190px;">
        <input type="text" class="jr_text" value="<%=CommonString.getFormatPara(model.get("number")) %>" readonly/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">图片</div>
    <div class="formRight" style="width:400px;">
      <input type="text" readonly="readonly" style="width: 400px;float:left;" class="jr_text" name="zd_img" id="zd_img" value="<%=CommonString.getFormatPara(model.get("img")) %>" />
    </div>
    <div class="formRight" style="width: 100px;"> <a href="<%=CommonString.getFormatPara(model.get("img")) %>" id="a_img" onclick='return hs.expand(this)'><img src="/backend/images/yulan.gif" /></a> <span id="equi_img"></span> </div>
  <div style="clear: left;"></div>  
  <div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">联系人信息</span> </div>
    <div class="formLeft">联系人</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_link_man" id="zd_link_man" value="<%=CommonString.getFormatPara(model.get("link_man")) %>" />
    </div>
    <div class="formLeft">手机号</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_mobile" id="zd_mobile" value="<%=CommonString.getFormatPara(model.get("mobile")) %>" />
    </div>
    <div style="clear:left;"></div>
    <div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">处理信息</span> </div>
    <div class="formLeft">目前状态</div>
    <div class="formRight">
      <%=CommonForm.createRadio(enumMap118,CommonString.getFormatPara(model.get("state")),"zd_state") %>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">退款金额</div>
    <div class="formRight" style="width:590px; text-align:left;">
      <input type="text" class="jr_text" style="width:100px;" dataType="Double" msg="请输入正确的退款金额" name="zd_refund_price" id="zd_refund_price" value="<%=CommonString.getFormatDouble(model.get("refund_price")) %>" />
      <label>(与购买者确认后的退款金额)</label>
        <!--<a href="javascript://void(0);" onclick="refundAlertEmail();" style="margin-left:20px;">邮件通知财务进行退款</a>-->
      <span id="refundEmailTip" style="margin-left:10px; color:red; display:none;">已发送</span>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">处理结果</div>
    <div class="formRight" style="height: 55px; text-align: left;"> 
      <textarea class="jr_textarea" id="zd_msg" name="zd_msg" style="height:50px"><%=CommonString.getFormatPara(model.get("msg")) %></textarea>
    </div>
    <div style="clear:left;"></div>
  <input type="hidden" name="tableName" id="tableName" value="<%=tableName %>" />
  <input type="hidden" name="zd_id" id="zd_id" value="<%=CommonString.getFormatPara(model.get("id")) %>" />
  <input type="hidden" name="zd_channel_uuid" id="zd_channel_uuid" value="<%=channelUUID %>" />
</form>
</body>
</html>
<script type="text/javascript" src="/plugin/jquery/jquery.form.js"></script>
<script src="/plugin/ui/ligerUI/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="/plugin/date/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="/backend/scripts/common.js" prefix="<%=tablePrefix %>" type="text/javascript"></script>
<script src="/plugin/validator/wofoshan/validator.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/plugin/other/highslide/highslide.min.js"></script>
<script type="text/javascript" src="http://img.52sdskj.com/plugin/upload/jr_upload.js"></script>
<script type="text/javascript">
	hs.graphicsDir = '/plugin/other/highslide/graphics/';
	hs.wrapperClassName = 'wide-border';
	jQuery("#equi_img").JrUpload({
        remotUrl: "http://img.52sdskj.com/upload.jsp",
		folder : "saygou" ,
		watermark:false,
		callback : "setEquiImg"
	});
	function setEquiImg(data){
        var imgUrl = "http://img.52sdskj.com" + data;
		jQuery("#a_img").attr("href",imgUrl);
		jQuery("#zd_img").val(imgUrl);
	}

	function doSub(){
		var rs = Validator.Validate(document.getElementById("theform"),1);
		if(rs){
			jQuery("#theform").ajaxSubmit({
				type : "POST",
				async : false ,
				success : function(data) {
					var rs = parseInt(jQuery.trim(data), 10);
					if (rs > 0 ) {
						jrSuccess("保存成功！");
						
						<%
						if("".equals(id)){
							%>
						window.location.reload();
							<%
						}
						%>
					} 
				}
			});
		}
	}
	
	function refundAlertEmail(){
		var refund_price = parseFloat($.trim($("#zd_refund_price").val()));
		if(refund_price<=0){
			jrWarn("尚未输入退款金额！");
		}else{
			//发送给财务的退款提醒邮件
			$.ajax({
				type:"post",
				url:"/backend/action/ajax_r.jsp",
				data:{flag:"refundAlertEmail", order_num:"<%=CommonString.getFormatPara(model.get("order_num")) %>", refund_price:refund_price, enumNo:"106013"},
				success:function(result){
					if($.trim(result)=="1"){
						$("#refundEmailTip").show().delay(3000).hide(0);
					}
				}
			});
		}
	}
	
	function viewOrderDetail(order_num){
		$.ajax({
			type:"post",
			url:"/backend/action/ajax_r.jsp",
			data:{flag:"getOrderUUID",order_num:order_num,enumNo:"106013"},
			success:function(result){
				var uuid = $.trim(result);
				if(uuid!=""){
					toolbarAdd({
			    		width:700,
			    		height:600,
			    		title:'查看订单',
			    		folderName:"gift.21-sun.com/gift_order",
						fileName:"gift_order"
			    	},uuid);
				}
			}
		});
	}
</script>
<%
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		dbHelper.freeConnection(connection);
	}
%>